package com.moyq5.spring.boot.app.register;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Moyq5
 * @date 2019年3月7日
 */
public class AppStoreDefault implements AppStore {

	protected final ConcurrentHashMap<Serializable, AppInfo> apps = new ConcurrentHashMap<>();
	
	@Override
	public void add(AppInfo info) {
		apps.put(info.getAppId(), info);
	}

	@Override
	public void remove(Serializable appId) {
		apps.remove(appId);
	}

	@Override
	public List<AppInfo> list() {
		return new ArrayList<AppInfo>(apps.values());
		
	}

	@Override
	public AppInfo get(Serializable appId) {
		return apps.get(appId);
	}

}
